-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Allow Clippy to define duplicate extra symbols #143596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Allow Clippy to define duplicate extra symbols #143596
Conversation
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
393f4ae
to
aebfd04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clippy changes LGTM
This seems to be quite above my personal threshold for the compiler to maintain and support this, since it isn't a mechanism used by the compiler itself. Do you think there could be an easier solution here? For example, rustc may expose the number of symbols, then clippy could scan the rustc list (either the file itself, or exposed through a constant) to error at compile time if there is a duplicate symbol. Or clippy could use a |
☔ The latest upstream changes (presumably #144449) made this pull request unmergeable. Please resolve the merge conflicts. |
An update on this:
This works with the new const In the meanwhile #146347 improves the runtime error |
Fixes #142410 (comment)
rustc_macros::symbols
now also expands to a macroextra_symbols
that callsrustc_macros::extra_symbols_impl
with the prefill stream so that it can know which symbols are duplicatedextra_symbols
allows supplying a name to define a macro to provide even more extra symbols, this is useful for external drivers that rely onclippy_utils
e.g. TheBevyFlock/bevy_cli#456There's a usage example in
compiler/rustc_span/src/symbol/tests.rs
DUPLICATE_SYMBOLS
is currently unused, but we can use it on the clippy side to remove duplicates without interfering withr-l/rust
PRs